<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"          			
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"   
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="TaskProLayout.xhtml">
        <ui:define name="content">  
            <div class="Post">
                <h:form id="chooseSubjects">
                    <p:dataTable id="subjectForm" value="#{teamBean.kantorSubject}" var="subject" selectionMode="single"
                                 selection="#{teamBean.subjectSelected}" rendered="true"
                                 rowKey="#{subject.code}" paginator="true" paginatorAlwaysVisible="false" rows="10">
                        <f:facet name="header">
                            <h:outputText value="Subjects" />
                        </f:facet>
                        <p:column headerText="Subject code">
                            <h:outputText value="#{subject.code}" />
                        </p:column>
                        <p:column headerText="Subject description">
                            <h:outputText value="#{subject.description}" >
                                <f:converter converterId="StringConverter" />
                            </h:outputText>
                        </p:column>      
                        <f:facet name="footer">  
                            <p:commandButton value="Select" update=":groupForm,:studentForm" action="#{teamBean.subjectSelect()}"/>  
                        </f:facet>  
                    </p:dataTable>
                    <h:outputText value="To select or unselect use CTRL"/>
                </h:form>
            </div>
            <div class="Post">
                <h:form id="groupForm">     
                    <p:dataTable id="groupTable" value="#{teamBean.kantorGroup}" var="group" selectionMode="single"
                                 selection="#{teamBean.groupSelected}" rendered="#{teamBean.groupTablerend}"
                                 rowKey="#{group.id}" paginator="true" paginatorAlwaysVisible="false" rows="10">
                        <f:facet name="header">
                            <h:outputText value="Groups" />
                        </f:facet>
                        <p:column headerText="Group code">
                            <h:outputText value="#{group.code}" />
                        </p:column>
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Start time" />  
                            </f:facet>  
                            <h:outputText value="#{group.startTime}" >
                                <f:convertDateTime type="time" timeZone="Europe/Prague"></f:convertDateTime>
                            </h:outputText>
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Stop time" />  
                            </f:facet>  
                            <h:outputText value="#{group.stopTime}" >
                                <f:convertDateTime type="time" timeZone="Europe/Prague"></f:convertDateTime>
                            </h:outputText>
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Date of teach" />  
                            </f:facet>  
                            <h:outputText value="#{group.dayOfTeach}" />  
                        </p:column>  
                        <f:facet name="footer">  
                            <p:commandButton value="Select" update=":studentForm" action="#{teamBean.groupSelect()}"/>  
                        </f:facet>  
                    </p:dataTable>
                    <h:outputText value="To select or unselect use CTR or SHIFT" rendered="#{teamBean.groupTablerend}"/>
                </h:form>  
            </div>
            <div class="Post">
                <h:form id="studentForm">
                    <p:dataTable id="studentTable" value="#{teamBean.students}" var="student" selectionMode="multiple"
                                 selection="#{teamBean.selectedStudents}" rendered="#{teamBean.studentsRendered}"
                                 rowKey="#{student.login}" paginator="true" paginatorAlwaysVisible="false" rows="10">
                        <f:facet name="header">
                            <h:outputText value="Available students" />
                        </f:facet>                
                        <p:column headerText="Student surname">
                            <h:outputText value="#{student.surname}" />
                        </p:column>
                        <p:column headerText="Student name">
                            <h:outputText value="#{student.name}" />
                        </p:column>
                        <p:column headerText="Student login">
                            <h:outputText value="#{student.login}" >
                                <f:converter converterId="StringConverter" />
                            </h:outputText>
                        </p:column>
                        <p:column headerText="Student e-mail">
                            <h:outputText value="#{student.email}" />
                        </p:column>
                        <f:facet name="footer">  
                            <p:commandButton value="Select" ajax="false" action="#{teamBean.studentSelect()}"/>  
                        </f:facet>  
                    </p:dataTable>
                    <h:outputText value="Multiple select or unselect use CTR or SHIFT" rendered="#{teamBean.studentsRendered}"/>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>
</html>